package com.example.video.plateRecognition.adapter;


import com.example.video.plateRecognition.client.dto.LicensePlateAddCmd;
import com.example.video.plateRecognition.client.dto.LicensePlateDeleteCmd;
import com.example.video.common.http.HttpResult;
import com.example.video.plateRecognition.client.api.PlateRecognitionService;
import com.example.video.plateRecognition.client.dto.LicensePlateListQry;
import com.example.video.plateRecognition.client.dto.LoginQry;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping(path = "/api/video/plateRecogintion")
@Api(tags = "车牌识别模块接口", description = "")
public class PlateRecognitionController {

    @Autowired
    private PlateRecognitionService plateRecognitionService;

    @PostMapping("/add")
    @ApiOperation(value = "添加车牌号")
    public HttpResult add(@RequestBody LicensePlateAddCmd command){
        plateRecognitionService.add(command);
        return HttpResult.ok("车牌号："+command.getPlateNumber()+",下发成功");
    }

    @PostMapping("/delete")
    @ApiOperation(value = "删除车牌号")
    public HttpResult delete(@RequestBody LicensePlateDeleteCmd command){
        plateRecognitionService.delete(command);
        return HttpResult.ok("车牌号："+command.getPlateNumber()+",删除成功");
    }

    @PostMapping("/list")
    @ApiOperation(value = "获取车牌号列表")
    public HttpResult list(@RequestBody LicensePlateListQry command){
        plateRecognitionService.list(command);
        return HttpResult.ok();
    }

    @PostMapping("/getDeviceSystemAbility")
    @ApiOperation(value = "获取设备系统能力集")
    public HttpResult getDeviceSystemAbility(@RequestBody LoginQry qry){
        String deviceSystemAbility = plateRecognitionService.getDeviceSystemAbility(qry);
        return HttpResult.ok(deviceSystemAbility);
    }
}
